package com.quantdo.menu;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;

import com.quantdo.shell.editor.TmEditor;

public class TomcatManageNewAction extends Action{

	private IWorkbenchWindow window;
	
	public TomcatManageNewAction(IWorkbenchWindow window) {
		this.window = window;
		setText("&Tomcat管理新@Ctrl+Alt+N");
		setToolTipText("Tomcat");
	}

	@Override
	public void run() {
		if (null == window) return;
		IEditorPart editor = window.getActivePage().findEditor(TmEditor.GENARAL_INPUT);
		if(null != editor){
			window.getActivePage().bringToTop(editor);
		}
		else{
			try {
				window.getActivePage().openEditor(TmEditor.GENARAL_INPUT,TmEditor.class.getName());
			} catch (PartInitException e) {
				e.printStackTrace();
				System.out.printf("文件不存在\n");
			}
		}
	}

	
}
